import {
  getPage
} from '../../utils/config';
import api from '../../utils/api';
import {
  http,
  $loading,
  $toast,
  promisify,
  storage
} from '../../utils/utils';
import uploadImage from '../../utils/aliyunoss/uploadAliyun';
import wxApi from '../../utils/wxApi';
const app = getApp();

Page({

  /**
   * 页面的初始数据
   */
  data: {
    //数据有变化
    getPage: getPage,
    logged: 0,
    shop: null,
    ismore:false
  },

  handleOverText(){
    this.setData({
      ismore:!this.data.ismore
    })
  },

  goqiandao(){
    wxApi.navigateTo(getPage.signin);
  },
  
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad() {
    //获取登录
    app.getLogin().then((res) => {
      console.log('res.data.user.user_name',res.data.user)
      if (res.data.shop == null)
        res.data.shop = {};
      this.setData({
        userInfo: res,
        logged: res.code,
        nickName: res.data.user.nickname,
        userId: res.data.user.user_id,
        ShopId: res.data.shop.ShopId,
        avatar: res.data.user.head_url,
        rank_points:res.data.user.rank_points,
      });
    }).catch((res) => {
      this.setData({
        logged: res
      });
    });
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  }
})